package com.ymatou.query.seller.trading.api.service;

import org.json.JSONException;
import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 用户账户信息Call FreeMaker Template自动生成代码
 */
public class GetUserAccountInfoCall_seller extends YmatouBaseCall {
	private static String opurl = "api/App/GetUserAccountInfo";

	public GetUserAccountInfoCall_seller() {
		super(EnvSetup.getSystemUrl("api_seller_order_query"), opurl, "GET", "PARAM");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String BCode = null;
		try {
			BCode = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Data
	 * 
	 * @return
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			Data = new JSONObject(getReturnData()).getJSONObject("Data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}

	/**
	 * 获取账户余额
	 * 
	 * @return
	 */
	public long getAccountAmount() {
		long AccountAmount = 0;
		try {
			AccountAmount = getData().getLong("AccountAmount");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return AccountAmount;
	}

	/**
	 * 获取红包账户余额
	 * 
	 * @return
	 */
	public long getGiftAmount() {
		long GiftAmount = 0;
		try {
			GiftAmount = getData().getLong("GiftAmount");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return GiftAmount;
	}

	/**
	 * 获取交易密码状态
	 * 
	 * @return
	 */
	public boolean getExistsTradingPwd() {
		boolean ExistsTradingPwd = false;
		try {
			ExistsTradingPwd = getData().getBoolean("ExistsTradingPwd");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return ExistsTradingPwd;
	}
}
